<template>
  <div class="full-box shadow-box padding-box">
    <OpreateBar
      :showQuestionAdd="true"
      @search="initData"
      @questionAdd="linkTo(`projectQuestionForm/0/1`)"
    >
      <template #condition>
        <div class="condition-item">
          <label>交办状态：</label>
          <el-select
            v-model="queryParams.assign_status"
            value-key=""
            placeholder=""
            clearable
            filterable
          >
            <el-option :key="-1" label="全部" value=""></el-option>
            <el-option :key="0" label="未交办" :value="0"></el-option>
            <el-option :key="1" label="已交办" :value="1"></el-option>
            <el-option :key="2" label="已办结" :value="2"></el-option>
          </el-select>
        </div>
      </template>
    </OpreateBar>
    <div class="table-wrapper">
      <BaseTable
        :columns="columns"
        :showSort="true"
        :tableData="tableData"
        :pages="{
          show: true,
          count: count,
        }"
        :operate="{
          show: true,
          width: 150,
        }"
        @pagination="pageChange"
      >
        <template #operate="{ current }">
          <el-button
            type="primary"
            size="mini"
            @click="linkTo(`projectQuestionForm/${current.row.id}/1`)"
            >详情</el-button
          >
        </template>
      </BaseTable>
    </div>
  </div>
</template>

<script>
import BaseTable from "@/components/Common/BaseTable.vue";
import { getQuestionList } from "@/api/MajorProjectPromotion/Index";
import OpreateBar from "./components/OpreateBar.vue";
import LinkTo from "@/mixins/LinkTo";
import commonList from "@/mixins/commonList";
export default {
  mixins: [LinkTo, commonList],
  components: { BaseTable, OpreateBar },
  data() {
    return {
      columns: columns,
      tableData: [],
      count: 0,
      queryParams: {
        pageNum: 1,
        pageSize: 20,
        source_type: 2,
        assign_status: "",
      },
    };
  },
  methods: {
    initData() {
      getQuestionList(this.queryParams).then((res) => {
        if (res.code == 0) {
          this.tableData = res.data;
          this.count = res.num;
        }
      });
    },
    pageChange(val) {
      this.queryParams.pageNum = val.pageNum;
      this.queryParams.pageSize = val.pageSize;
      this.initData();
    },
  },
  created() {
    this.initData();
  },
};

const columns = [
  {
    prop: "project_name",
    label: "项目名称",
    width: "",
    minWidth: "200",
    align: "",
  },
  {
    prop: "problem_desc",
    label: "问题描述",
    width: "",
    minWidth: "300",
    align: "",
  },
  {
    prop: "finish_limit_date",
    label: "期望问题解决期限",
    width: "",
    minWidth: "100",
    align: "",
  },
  {
    prop: "report_dept_name",
    label: "提交单位",
    width: "",
    minWidth: "100",
    align: "",
  },
  // {
  //   prop: "status_text",
  //   label: "审核结果",
  //   width: "",
  //   minWidth: "100",
  //   align: "",
  // },
];
</script>

<style lang="scss" scoped="">
</style>